package NC77_调整数组顺序使奇数位于偶数前面1;

public class Solution {
    public int[] reOrderArray (int[] array) {
        if (array == null || array.length <= 1){
            return array;
        }

        int[] res = new int[array.length];
        int index = 0;
        for (int value : array) {
            if ((value & 1) == 1) {
                res[index++] = value;
            }
        }
        for (int value : array) {
            if ((value & 1) == 0) {
                res[index++] = value;
            }
        }
        return res;
    }
}
